*** How worried should we be? The implications of fabricated survey data for political science
*** Table A9. Chow Tests for Political Tolerance Models

set more off

* set directory to location of dataset in following line
cd "C:\~\Downloads\"

use "VEN_fraud_data.dta", clear

gen wt = 1
gen upm = upm1
svyset upm [pw=wt], strata(estratopri)

** label data for full sample comparisons
* first drop canceled cases that were not likelyfrauds and matched to clean cases
drop if clean_data == 0 & cem_matched != 1
* 1 = fake, 2 = clean matched, 3 = rest of data
gen comparison_groups = 1 if likelyfraud == 1 & cem_matched == 1
replace comparison_groups = 2 if likelyfraud == 0 & cem_matched == 1
replace comparison_groups = 3 if likelyfraud == 0 & cem_matched == 0

* double the "rest of the dataset" (non-matched clean interviews)
gen exp=1
replace exp=2 if comparison_group == 3
expand exp, gen(copy)

* compromised versus clean indicator (1 = clean, 2 = compromised)
gen clean_or_compr = .
replace clean_or_compr = 1 if comparison_group == 2 | copy == 0
replace clean_or_compr = 2 if comparison_group == 1 | copy == 1

gen clean = 1 if clean_or_compr == 1
replace clean = 0 if clean_or_compr == 2

* presidential approval
recode m1 (1=5)(2=4)(3=3)(4=2)(5=1)(888888 988888 999999=.), gen(pres_approval)
label var pres_approval "Presidential Approval"
* turnout in 2013
gen turnout_2013 = 1 if vb2 == 1 & vb1 != 2
replace turnout_2013 = 0 if vb2 != 1 & vb1 != 2
label var turnout_2013 "Turnout in 2013"
* vote for maduro in 2013
gen maduro_2013 = 1 if vb3n == 1601 
replace maduro_2013 = 0 if vb3n != 1601
replace maduro_2013 = . if vb1 == 2
label var maduro_2013 "Vote for Maduro 2013"
* nonvoter in 2013
gen nonvoter_2013 = 1 if  turnout_2013 == 0
replace nonvoter_2013 = 0 if  turnout_2013 == 1
label var nonvoter_2013 "Non-Voter in 2013"
* community insecurity
recode aoj11 (888888 988888 999999=.), gen(local_insecurity)
label var local_insecurity "Neighborhood Insecurity"
* crime victimization
recode vic1ext (2=0)(888888 988888 999999=.), gen(crime_victim)
label var crime_victim "Crime Victimization"
* national econ evaluation
recode soct2 (3=1)(2=2)(1=3)(888888 988888 999999=.), gen(national_econ)
label var national_econ "National Economy Evaluation"
* personal econ evalaution
recode idio2 (3=1)(2=2)(1=3)(888888 988888 999999=.), gen(personal_econ)
label var personal_econ "Personal Economy Evaluation"
* trust in national police
recode b18 (888888 988888 999999=.), gen(trust_police)
label var trust_police "Trust in National Police"
* left-right ideology
recode l1 (888888 988888 999999=.), gen(left_right)
label var left_right "Left-Right Self Placement"
* left wing
gen left = 1 if inlist(l1, 1, 2, 3)
replace left = 0 if left == . & l1 != 999999
label var left "Left"
* center
gen center = 1 if inlist(l1, 4, 5, 6, 7)
replace center = 0 if center == . & l1 != 999999
label var center "Center"
* right wing
gen right = 1 if inlist(l1, 8, 9, 10)
replace right = 0 if right == . & l1 != 999999
label var right "Right"
* dk/na ideology
gen non_ideo = 1 if inlist(l1, 888888, 988888)
replace non_ideo = 0 if non_ideo == . & l1 != 999999
label var non_ideo "DK/NA Ideology"
* skintone
label var skintone "Skin Tone"
* interviewer skintone
gen skintone_int = colori
replace skintone_int = . if colori == 999999
label var skintone_int "Interviewer Skin Tone"
* support for democracy
gen dem_support = ing4
replace dem_support = . if inlist(ing4, 888888, 988888, 999999)
label var dem_support "Support for Democracy" 
* respect for pol institutions
recode b2  (888888 988888 999999=.)
label var b2 "Respect for Pol. Institutions"
* opposition threat
recode vengrp4 (4=1)(3=2)(2=3)(1=4)(888888 988888 999999=.), gen(opp_threat)
replace opp_threat = (opp_threat - 1) / 3
la var opp_threat "Perception of Threat"
* political tolerance (peaceful demonstration)
recode d2 (888888 988888 999999=.), gen(pol_tolerance)
label var pol_tolerance "Political Tolerance"
* external efficacy
recode eff1 (7=1)(6=2)(5=3)(4=4)(3=5)(2=6)(1=7)(888888 988888 999999=.), gen(ext_eff)
replace ext_eff = (ext_eff - 1) / 6
lab var ext_eff "External Efficacy"
* internal efficacy
recode eff2 (888888 988888 999999=.), gen(int_eff)
replace int_eff = (int_eff - 1) / 6
lab var int_eff "Internal Efficacy"
* efficacy 
gen efficacy = ext_eff + int_eff
replace efficacy = efficacy / 2
lab var efficacy "Political Efficacy"

* recode everything 0-1
replace b2 = (b2 - 1)/6
replace local_insecurity = (local_insecurity - 1)/3
replace trust_police = (trust_police - 1)/6
replace national_econ = (national_econ - 1)/2
replace personal_econ = (personal_econ - 1)/2
replace skintone = (skintone - 1)/9
replace pres_approval = (pres_approval-1)/ 4

* recode educ and age
gen age = (edad - 1)/5
lab var age "Age"
gen educ = (ed_level - 1)/2
lab var educ "Level of Education"

* models
eststo clear
svy: reg pol_tolerance opp_threat efficacy educ mujer age if clean_or_compr == 1
estimates store clean
svy: reg pol_tolerance opp_threat efficacy educ mujer age if clean_or_compr == 2
estimates store compromised

* Table A9 Chow test values
suest clean compromised
test [clean]opp_threat - [compromised]opp_threat = 0
test [clean]efficacy - [compromised]efficacy = 0
test [clean]educ - [compromised]educ = 0
test [clean]mujer - [compromised]mujer = 0
test [clean]age - [compromised]age = 0
